package com.dts.yjnb.service.admincontroller;

import com.dts.common.core.controller.BaseController;
import com.dts.common.core.domain.AjaxResult;
import com.dts.yjnb.service.domain.Region;
import com.dts.yjnb.service.domainDto.RegionDTO;
import com.dts.yjnb.service.service.IRegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 区域管理 信息操作处理
 *
 * @author dts
 */
@Api(tags = "区域管理相关接口")
@RestController
@RequestMapping("/yjnb/region")
@Slf4j
public class RegionController extends BaseController
{

    @Autowired
    private IRegionService regionService;

    /**
     * 查询区域列表
     */
    @GetMapping("/list")
    @ApiOperation("查询区域列表")
    @Cacheable(cacheNames = "region", key = "'all'")
    public AjaxResult list(RegionDTO regionDTO) {
        log.info("查询区域列表:{}", regionDTO);
        List<Region> list = regionService.list(regionDTO);
        return AjaxResult.success(list);
    }
}

